#include <stdio.h>
#include <stdlib.h>

int add(int a,int b)
{

	return a + b;

}
int sub(int a,int b)
{


	return a - b;
}

int main(void)
{

	int a = 3,b = 5;
	int ret;
#if 0
	int (*p) (int,int);
	int (*q) (int,int);

	p = add;
//add 函数名为地址 

//	ret = add(a,b);
	ret = p(a,b);
//*可以省略
	printf("%d\n",ret);


	q = sub;
	ret = q(a,b);
	printf("%d\n",ret);
#else
	int i = 0;	
	int (*funcarr[2])(int,int);
/*
	funcarr[0]=add;
	funcarr[1]=sub;
*/
	*(funcarr+0)=add;
	*(funcarr+1)=sub;
	for (i=0;i<2;i++)
	{
		ret = funcarr[i](a,b);
		printf("%d\n",ret);
	}
#endif
	
	exit(0);
}
